<template>
  <div>
    <div style="margin: 10px 0">
      <el-carousel height="500px">
        <el-carousel-item v-for="item in img_list" :key="item">
          <img :src="item" alt="" style="width: 100%">
        </el-carousel-item>
      </el-carousel>
    </div>

    <div style="margin: 10px 0">
      <el-row :gutter="10">
        <el-col :span="6" v-for="item in files" :key="item.id" style="margin-bottom: 10px">
          <div style="border: 1px solid #ccc; padding-bottom: 10px">
            <img :src="item.url" alt="" style="width: 100%; height: 250px">
            <div style="color: #666; padding: 10px">{{ item.name }}</div>
            <div style="padding: 10px"><el-button type="primary">购买</el-button></div>
          </div>
        </el-col>
      </el-row>
    </div>

  </div>
</template>

<script>
export default {
  name: "FrontHome",
  data() {
    return {
      img_list: [
          require('@/assets/images/1.webp'),
          require('@/assets/images/2.webp'),
          require('@/assets/images/3.webp'),
          require('@/assets/images/4.webp'),
          require('@/assets/images/5.webp'),
          require('@/assets/images/6.webp'),
      ],
      files: []
    }
  },
  created() {
    this.request.get("/file").then(res => {
      this.files = res.data.filter(v => v.type === 'png' || v.type ==='webp' || v.type === 'jpg' || v.type === 'jpeg');
    })
  }
}
</script>

<style>

</style>